package com.hzvictory.hotel_system.controller;
import java.util.List;

import com.hzvictory.hotel_system.common.core.controller.BaseController;
import com.hzvictory.hotel_system.common.core.page.TableDataInfo;
import com.hzvictory.hotel_system.service.IEvaluationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.hzvictory.hotel_system.pojo.entity.Evaluation;
import com.hzvictory.hotel_system.common.annotation.Log;
import com.hzvictory.hotel_system.common.core.domain.AjaxResult;
import com.hzvictory.hotel_system.common.enums.BusinessType;
//import com.ruoyi.common.utils.poi.ExcelUtil;
import com.hzvictory.hotel_system.common.core.page.TableDataInfo;

/**
 * 功能
 * 作者：何征
 * 日期：2025/7/21 18:04
 */
@RestController
@RequestMapping("/system/evaluation")
public class EvaluationController extends BaseController {
    @Autowired
    private IEvaluationService evaluationService;

    /**
     * 查询评价列表
     */
    //@PreAuthorize("@ss.hasPermi('system:evaluation:list')")
    @GetMapping("/list")
    public TableDataInfo list(Evaluation evaluation)
    {
        startPage();
        List<Evaluation> list = evaluationService.selectEvaluationList(evaluation);
        return getDataTable(list);
    }
    /**
     * 获取评价详细信息
     */
    //@PreAuthorize("@ss.hasPermi('system:evaluation:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(evaluationService.selectEvaluationById(id));
    }

    /**
     * 新增评价
     */
   // @PreAuthorize("@ss.hasPermi('system:evaluation:add')")
    @Log(title = "评价", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Evaluation evaluation)
    {
        return toAjax(evaluationService.insertEvaluation(evaluation));
    }

    /**
     * 修改评价
     */
    //@PreAuthorize("@ss.hasPermi('system:evaluation:edit')")
    @Log(title = "评价", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Evaluation evaluation)
    {
        return toAjax(evaluationService.updateEvaluation(evaluation));
    }

    /**
     * 删除评价
     */
    //@PreAuthorize("@ss.hasPermi('system:evaluation:remove')")
    @Log(title = "评价", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(evaluationService.deleteEvaluationByIds(ids));
    }
}
